﻿//-----------------------------------------------------------------------
// <copyright file="Copyright.cs" author="Michael Herndon">
//     Copyright (c) Company.  All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace Amplify.CodeDom
{
	using System;
	using System.Collections.Generic;
	using System.CodeDom;
	using System.Linq;
	using System.Text;

	public static partial class Mixin
	{



		public static CodeTypeMember XorAccessMask(this CodeTypeMember unit, MemberAttributes attribute)
		{
			unit.Attributes = (unit.Attributes & ~MemberAttributes.AccessMask) ^ attribute;
			return unit;
		}

		public static CodeTypeMember XorScopeMask(this CodeTypeMember unit, MemberAttributes attribute)
		{
			unit.Attributes = (unit.Attributes & ~MemberAttributes.ScopeMask) ^ attribute;
			return unit;
		}

		public static CodeTypeMember OrAccessMask(this CodeTypeMember unit, MemberAttributes attribute)
		{
			unit.Attributes = (unit.Attributes
						& ~MemberAttributes.AccessMask) | attribute;
			return unit;
		}

		public static CodeTypeMember OrScopeMask(this CodeTypeMember unit, MemberAttributes attribute)
		{
			unit.Attributes = (unit.Attributes & ~MemberAttributes.ScopeMask) | attribute;
			return unit;
		}


		public static CodeTypeDeclaration Add(this CodeTypeDeclarationCollection unit, string name) 
		{
			CodeTypeDeclaration type = new CodeTypeDeclaration(name);
			unit.Add(type);
			return type;
		}

		public static CodeTypeDeclaration AddType(this CodeNamespace unit, string name)
		{
			return unit.Types.Add(name);
		}

		public static CodeTypeDeclaration AddClass(this CodeNamespace unit, string name)
		{
			CodeTypeDeclaration type = unit.Types.Add(name);
			type.IsClass = true;
			return type;
		}

		public static CodeTypeDeclaration AddPartialClass(this CodeNamespace unit, string name)
		{
			CodeTypeDeclaration type = unit.AddClass(name);
			type.IsPartial = true;
			return type;
		}

		
	}
}
